#import <Foundation/Foundation.h>
#import "TopicModel.h"

@protocol TopicManagerDelegate;

@interface TopicManager : NSObject
{
    NSString *urlPrx;
    NSString *httpSort;
    int backIndex;
    NSMutableArray          *listNext;
    NSMutableArray          *listLocal;
    NSMutableSet            *setShow;
    NSMutableDictionary     *dicLocal;
    BOOL started;
    id<TopicManagerDelegate> delegate;
}

@property (nonatomic,assign)    int             sortIndex;
@property (nonatomic,copy)      NSString        *dbSort;
@property (atomic,retain)       NSMutableArray  *listShow;
@property (atomic,assign)       BOOL            gettingNext;
@property (atomic,assign)       BOOL            gettingNew;

-(id)initWithSort:(int)pSortIndex :(NSString *)pDBsort :(NSString *)pHTTPsort :(id<TopicManagerDelegate>) pDelegate;
-(void)startAsync;
-(void)getNewAsync;
-(void)getNextAsync;
-(void)httpNewSync:(BOOL)initing;
-(void)httpNextSync;
-(void)clearTopicData;

-(TopicModel *)httpTopicDetail:(NSString *)topicId;
-(NSMutableArray *)httpGetReplySync:(NSString *)topicId;

@end

@protocol TopicManagerDelegate<NSObject>
@optional
-(void)TMloadNew:(TopicManager *)pTopicManager :(int)newCount :(BOOL)initing;
-(void)TMloadNext:(TopicManager *)pTopicManager :(int)nextCount;
@end
